using UnityEngine;
using System.Collections;

public class NaveR1 : MonoBehaviour {
	
	float desloc = 1f;
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		transform.position = new Vector3 (transform.position.x, transform.position.y, transform.position.z - desloc);
		if (transform.position.z < -10){
			restartNave();
		}
	}
	
	void OnTriggerEnter(Collider collider){
	}
	
	
	void restartNave ()	{
		
		float random = Random.Range(-20, 20);
			
			transform.position = 
				new Vector3(random, transform.position.y, 300);
	}
}
